//  加载模块
import Vue from 'vue';
import VueRouter from 'vue-router';
// import { use } from 'vue/types/umd'

//  加载file
import Login from '../views/login.vue'
import Index from '../views/index.vue';
import Home from '../views/home.vue';
import Info from '../views/info.vue';
import My from '../views/my.vue';
import Detail from '../views/detail.vue';
import Appoint from '../views/appoint.vue';

//  框架应用路由
Vue.use(VueRouter);

//  配置路由
const routers = [{
    path: '/',
    name: 'Login',
    // component: '../views/index.vue'
    component: Login,
    meta: {
        title: '首页',
        keepAlive: true //  不重复渲染
    }
}, {
    path: '/index',
    name: 'index',
    // component: '../views/index.vue'
    component: Index,
    meta: {
        title: '首页',
        keepAlive: true
    }
}, {
    path: '/home',
    name: 'home',
    // component: '../views/index.vue'
    component: Home,
    meta: {
        title: '房源',
        keepAlive: true
    }
}, {
    path: '/info',
    name: 'info',
    component: Info,
    meta: {
        title: '资讯',
        keepAlive: true
    }
}, {
    path: '/my',
    name: 'my',
    component: My,
    meta: {
        title: '我的',
        keepAlive: true
    }
}, {
    path: '/detail/:hid/:type',
    name: 'detail',
    component: Detail,
    meta: {
        title: '房源详情页',
        keepAlive: false //  需要重复渲染
    }
}, {
    path: '/appoint/:hid',
    name: 'appoint',
    component: Appoint,
    meta: {
        title: '房源详情页',
        keepAlive: false //  需要重复渲染
    }
}]

//  实例化路由对象
const router = new VueRouter({
    linkExactActiveClass: 'active', //  
    routes: routers
});

//  默认输出路由对象（只输出一次）
export default router;